package com.xpd.spring.demo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ConcurrentModificationException;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Person {
    String name;
    int age;
    char gender;
    List<String> like;
    Person father;
    Person mother;

    public Person(String name, int age) {
        System.out.println("我是构造函数一");
        this.name = name;
        this.age = age;
    }
    public Person(int age,String name) {
        System.out.println("我是构造函数二");
        this.name = name;
        this.age = age;
    }

    public void hello(){
        System.out.println(name+age);
    }
//工厂方法
    public Person create(){
        return new Person("王五",20);
    }
    //静态工厂方法
    public static Person staticcreate(){
        return new Person("赵六",20);
    }
    //初始化和构造函数的区别  初始化已经完成了对象的赋值
    void init(){
        System.out.println("对象创建成功");
    }

    void destory(){
        System.out.println("对象销毁成功");
    }
}
